﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
namespace DAL
{
    public class Course
    {
        public string conStr;
        public SqlConnection conn;
        public Course()
        {
            conStr = ConfigurationManager.ConnectionStrings["projectbConnection"].ConnectionString;
            conn = new SqlConnection(conStr);
        }
        public SqlDataReader select(string column)
        {
            try
            {
                conn.Open();
                string selectStatement = "select " + column + " from Course";
                SqlCommand cmd = new SqlCommand(selectStatement, conn);
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                return dr;
            }
            catch (SqlException e)
            {
                throw new Exception(e.Message);
            }
        }
    }
}
